/*
 * This class is responsible for validating user name and password fields
 */

package pos.control;

import pos.exception.POSException;
import pos.util.Validate;

/**
 *
 * @author Parvez
 */
public class AdminUserLoginControl {

    /**
     * Validate user and password fields
     * 
     * @param user String username
     * @param pass String password
     * @return boolean true if the username and password have passed text validations
     * @throws POSException for catching errors
     */
    public static boolean validateAdminLogin(String user, String pass) throws POSException {
        Validate val = new Validate();

        try {
            user = val.validTextInput(user);
            pass = val.validTextInput(pass);
            return true;
        } catch (POSException e) {
            throw new POSException(e.getMessage(), e);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
}
